<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Message center</title>
    <link rel="icon" href="">

    <!-- Bootstrap core CSS -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">


  </head>

  <body>

    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="/#">Message center</a>
        </div>
        <div id="navbar" class="collapse navbar-collapse">
          <ul class="nav navbar-nav">
            <li class="active"><a href="/#">Home</a></li>
            <li><a href="#about">About</a></li>
            <li><a href="#contact">Contact</a></li>
          </ul>

          {% if user %}
          <div class="navbar-form navbar-right">
            <ul class="nav navbar-nav">
             <li ><a href="#">{{ user  }}</a></li>
             <li><a href="logout">Logout</a></li>
            </ul>


          {% else %}
          <form class="navbar-form navbar-right" action="login" method="post" >
            <div class="form-group">
              <input type="text" placeholder="username" name="username" class="form-control">
            </div>
            <div class="form-group">
              <input type="password" placeholder="password" name="password" class="form-control">
            </div>
            <button type="submit" class="btn btn-success">Sign in</button>
          </form>
        {% endif %}

        </div>

        <div id="navbar" class="navbar-collapse collapse">

        </div>
        <!--/.nav-collapse -->

      </div>
    </nav>

    <div class="container" >
      <style type="text/css">
      body {
        padding-top: 50px;
      }
      .starter-template {
        padding: 40px 15px;
        text-align: center;
      }
      </style>

      <div class="starter-template">


        <p class="lead">
        {% if user %}
        <br>
        <br>
        <h1>Hello, {{ user }}. </h1>

        {% if user == 'admin' %}
        Your flag: <br>
        {{ flag  }}

        {% else %}
        <br>
        <br>
        <h3>I will tell you a secret, but you should upload a zipfile first.</h3>
        <br>
        <br>
        <form action="/upload" method="post"
        enctype="multipart/form-data">

        <input type="file" name="the_file"  />
        <input type="submit" name="submit" value="Submit" />
        </form>
        <br>
        {% endif %}
        {% else %}
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
        <h1>For more information, please login.</h1>

        {% endif %}
        </p>

      </div>

    </div><!-- /.container -->

{% if forbidden %}
<script type="text/javascript">alert("Sorry, you are not admin!")</script>>
{% endif %}
  </body>
</html>